<?php

/**
 * DevisFournisseur filter form base class.
 *
 * @package    SdCommerce
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseDevisFournisseurFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'date'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'reference'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'lieu_livraison'  => new sfWidgetFormFilterInput(),
      'observation'     => new sfWidgetFormFilterInput(),
      'total_ht'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'total_remise'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'total_tva'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'total_ttc'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'total_netht'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'total_fodec'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'date_livraison'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'date_validite'   => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'mode_paiement'   => new sfWidgetFormChoice(array('choices' => array('' => '', 'Espece' => 'Espece', 'Cheque' => 'Cheque', 'Effet' => 'Effet'))),
      'id_fournisseur'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Fournisseur'), 'add_empty' => true)),
      'id_representant' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Representant'), 'add_empty' => true)),
      'num_up_echeance' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'valider'         => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'id_departement'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Departement'), 'add_empty' => true)),
      'created_at'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'date'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'reference'       => new sfValidatorPass(array('required' => false)),
      'lieu_livraison'  => new sfValidatorPass(array('required' => false)),
      'observation'     => new sfValidatorPass(array('required' => false)),
      'total_ht'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'total_remise'    => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'total_tva'       => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'total_ttc'       => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'total_netht'     => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'total_fodec'     => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'date_livraison'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'date_validite'   => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'mode_paiement'   => new sfValidatorChoice(array('required' => false, 'choices' => array('Espece' => 'Espece', 'Cheque' => 'Cheque', 'Effet' => 'Effet'))),
      'id_fournisseur'  => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Fournisseur'), 'column' => 'id')),
      'id_representant' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Representant'), 'column' => 'id')),
      'num_up_echeance' => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'valider'         => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'id_departement'  => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Departement'), 'column' => 'id')),
      'created_at'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('devis_fournisseur_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'DevisFournisseur';
  }

  public function getFields()
  {
    return array(
      'id'              => 'Number',
      'date'            => 'Date',
      'reference'       => 'Text',
      'lieu_livraison'  => 'Text',
      'observation'     => 'Text',
      'total_ht'        => 'Number',
      'total_remise'    => 'Number',
      'total_tva'       => 'Number',
      'total_ttc'       => 'Number',
      'total_netht'     => 'Number',
      'total_fodec'     => 'Number',
      'date_livraison'  => 'Date',
      'date_validite'   => 'Date',
      'mode_paiement'   => 'Enum',
      'id_fournisseur'  => 'ForeignKey',
      'id_representant' => 'ForeignKey',
      'num_up_echeance' => 'Number',
      'valider'         => 'Boolean',
      'id_departement'  => 'ForeignKey',
      'created_at'      => 'Date',
      'updated_at'      => 'Date',
    );
  }
}
